package com.cc.controller;

import com.cc.comm.responce.R;
import com.cc.model.vo.SupplierOrderGroupVo;
import com.cc.service.PurchaseSettlementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 采购结算表 前端控制器
 * </p>
 *
 * @author 晓东√
 * @since 2025-09-19 11:18
 */
@RestController
@RequestMapping("/purchaseSettlement")
public class PurchaseSettlementController {
    @Autowired
    private PurchaseSettlementService purchaseSettlementService;

    //手动生成结算单 只生成一次
    @GetMapping("/generateSettlement")
    public R generateSettlement() {
        purchaseSettlementService.generateSettlement();
        return R.success("生成结算单成功");
    }

    //查询采购结算单
    @GetMapping("/list")
    public R<List<SupplierOrderGroupVo>> list() {
        List<SupplierOrderGroupVo> supplierOrderGroupVos = purchaseSettlementService.groupList();
        return R.success(supplierOrderGroupVos);
    }


}
